<template>
  <div class="money-card">
    <div class="money-card-top">
      <div class="left">
        <div class="money-card-top-tip">可提现金额（元）</div>
        <div class="money-card-top-money">{{ fundsInfo.availWithdrawnFunds }}</div>
      </div>
      <div class="money-card-btn" @click="withdrawal">提现</div>
    </div>
    <div class="money-card-bottom">
      <div class="money-card-bottom-item">
        <div class="item-txt">总佣金（元）</div>
        <div class="item-money">{{ fundsInfo.totalFunds }}</div>
      </div>
      <div class="money-card-bottom-item">
        <div class="item-txt">已提现（元）</div>
        <div class="item-money">{{ fundsInfo.withdrawnFunds }}</div>
      </div>
      <div class="money-card-bottom-item">
        <div class="item-txt">审核金额（元）</div>
        <div class="item-money">{{ fundsInfo.reviewFunds }}</div>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
// @ts-nocheck
import { ref, watch } from "vue";
import { useRouter } from "vue-router";
import { getFundsInfo } from '@/api/withdrawal';

//在setup中
export default {
  name: "App",
  setup() {
    const router = useRouter();
    const withdrawal = () => {
      router.push({ path: '/withdrawal' })
    }

    return {
      withdrawal,
    };
  },
  data() {
    return {
      fundsInfo: {}
    }
  },
  mounted() {
    if (window.userInfo && window.userInfo.userInfo) {
      this.getFundsInfo()
    }
  },
  methods: {
    getFundsInfo() {
      getFundsInfo().then(res => {
        console.log(1);
        this.fundsInfo = res;
      })
    }
  }
};
</script>
<style lang="scss" scoped>
.money-card {
  height: 168px;
  background: linear-gradient(270deg, #3399EC 0%, #1760D4 100%);
  border-radius: 12px;

  .money-card-top {
    color: #FFFFFF;
    display: flex;
    justify-content: space-between;
    // align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    height: 108px;

    .left {
      margin-left: 15px;
      margin-top: 25px;

      .money-card-top-tip {
        color: rgba(255, 255, 255, 0.6);
        font-size: 12px;
      }

      .money-card-top-money {
        font-weight: bold;
        font-size: 36px;
      }
    }

    .money-card-btn {
      margin-top: 30px;
      margin-right: 10px;
      width: 56px;
      height: 28px;
      background: rgba(255, 255, 255, 0.3);
      border-radius: 6px;
      border: 1px solid rgba(255, 255, 255, 0.2);
      text-align: center;
      line-height: 28px;
    }
  }

  .money-card-bottom {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;

    .money-card-bottom-item {

      .item-txt {
        color: rgba(255, 255, 255, 0.6);
        font-size: 12px;
      }

      .item-money {
        color: white;
        font-size: 16px;
      }
    }
  }
}
</style>
